<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">全局设备统计-设备渠道 </ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"/>

                        <p:columnToggler datasource="statMarketLoginDataTable" trigger="toggler"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"/>
                        <p:commandButton value="重置" icon="fa fa-refresh" actionListener="#{statMarketLoginBean.onRest()}"
                                         update="@form"/>
                        <p:commandButton value="导出" icon="fa fa-download"
                                         ajax="false">
                            <p:dataExporter type="csv" target="statMarketLoginDataTable" fileName="export" encoding="GBK"/>
                        </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <h1>查询条件</h1>
                            <p:panelGrid columns="8" layout="grid"
                                         columnClasses="ui-grid-col-1,ui-grid-col-2"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">

                                <p:outputLabel for="startDate" value="开始日期"/>
                                <p:calendar id="startDate" value="#{statMarketLoginBean.$.startDate}"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATE_FORMAT')}"/>

                                <p:outputLabel for="endDate" value="结束日期"/>
                                <p:calendar id="endDate" value="#{statMarketLoginBean.$.endDate}"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATE_FORMAT')}"/>

                                <p:outputLabel for="productId" value="产品"/>
                                <p:selectOneMenu id="productId" value="#{statMarketLoginBean.$.productId}"
                                                 filter="true" filterMatchMode="contains">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{statMarketLoginBean.commProductIds}"
                                            var="product"
                                            itemLabel="#{product.name}" itemValue="#{product.productId}"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="channelCode" value="渠道"/>
                                <p:selectOneMenu id="channelCode" value="#{statMarketLoginBean.$.channelCode}"
                                                 filter="true" filterMatchMode="contains">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{statMarketLoginBean.commProductChannels}"
                                            var="channel"
                                            itemLabel="#{channel.channelName}" itemValue="#{channel.channelCode}"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="secondaryChannelGroup" value="二级渠道分类"/>
                                <p:selectOneMenu id="secondaryChannelGroup" value="#{statMarketLoginBean.$.secondaryChannelGroup}"
                                                 filter="true" filterMatchMode="contains">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems value="#{statMarketLoginBean.secondaryChannelGroups}"
                                                   var="dic"
                                                   itemLabel="#{dic.channelName}" itemValue="#{dic.id}"/>
                                </p:selectOneMenu>
                            </p:panelGrid>
                        </div>
                        <div class="card">
                            <p:dataTable id="statMarketLoginDataTable"
                                         style="width: 100%"
                                         var="record"
                                         value="#{statMarketLoginBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         scrollWidth="97%"
                                         reflow="true"
                                         selection="#{statMarketLoginBean.selectedRecords}"
                                         resizableColumns="true">

                                <p:column headerText="日期">
                                    <h:outputText value="#{record.createDate}">
                                        <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="所属大产品">
                                    <h:outputText value="#{statMarketLoginBean.translate(DictionaryCode.LARGE_COMMON_PRODUCT,record.parentProductId)}"/>
                                </p:column>
                                <p:column headerText="产品">
                                    <h:outputText value="#{statMarketLoginBean.translateProduct(record.productId)}"/>
                                </p:column>
                                <p:column headerText="渠道">
                                    <h:outputText value="#{statMarketLoginBean.translateProductChannel(record.channelCode)}"/>
                                </p:column>
                                <p:column headerText="二级渠道分类">
                                    <h:outputText
                                            value="#{statMarketLoginBean.translateSecondaryChannelGroup(record.secondaryChannelGroup)}"/>
                                </p:column>
                                <p:column headerText="登录人数a（设备渠道）">
                                    <h:outputText value="#{record.loginCountA}"/>
                                </p:column>
                                <p:column headerText="登录人数b（截流前）">
                                    <h:outputText value="#{record.loginCountB}"/>
                                </p:column>
                                <p:column headerText="注册人数a（全库）">
                                    <h:outputText value="#{record.registerCountA}"/>
                                </p:column>
                                <p:column headerText="注册人数b（大产品）">
                                    <h:outputText value="#{record.registerCountB}"/>
                                </p:column>
                                <p:column headerText="注册人数c（全库截流前）">
                                    <h:outputText value="#{record.registerCountC}"/>
                                </p:column>
                                <p:column headerText="注册人数d（大产品截流前）">
                                    <h:outputText value="#{record.registerCountD}"/>
                                </p:column>


                                <p:column headerText="参与uv和（大产品截流前）">
                                    <h:outputText value="#{record.bpUvTotal}"/>
                                </p:column>
                                <p:column headerText="参与uv和（api甲方）（大产品截流前）">
                                    <h:outputText value="#{record.bpUvApi}"/>
                                </p:column>
                                <p:column headerText="api进件人数b（大产品截流前）">
                                    <h:outputText value="#{record.bpApiApplyCount}"/>
                                </p:column>
                                <p:column headerText="api放款人数b（大产品截流前）">
                                    <h:outputText value="#{record.bpApiLendCount}"/>
                                </p:column>
                                <p:column headerText="api放款额b（大产品截流前）">
                                    <h:outputText value="#{record.bpApiLendAmount}"/>
                                </p:column>

                                <p:column headerText="新用户占比（全库）">
                                    <h:outputText value="#{record.newUserRate}"/>
                                </p:column>
                                <p:column headerText="新用户占比（大产品）">
                                    <h:outputText value="#{record.parentProductNewUserRate}"/>
                                </p:column>
                                <p:column headerText="新用户占比（全库截流前）">
                                    <h:outputText value="#{record.beforeClosureNewUserRate}"/>
                                </p:column>
                                <p:column headerText="新用户占比（大产品截流前）">
                                    <h:outputText value="#{record.beforeClosureParentProductNewUserRate}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
